using System.Web.Mvc;

namespace LiteGrid.Mvc.Results
{
	public class LiteGridJsonResult<T> : ActionResult
	{
		public T[] DataItems { get; set; }
		public bool Status { get; set; }

		public LiteGridJsonResult(T[] dataItems)
		{
			DataItems = dataItems;
			Status = true;
		}

		public override void ExecuteResult(ControllerContext context)
		{
			var result = new JsonResult
			             	{
			             		Data = new
			             		       	{
			             		       		dataItems = DataItems,
											status = Status
			             		       	},
								JsonRequestBehavior = JsonRequestBehavior.AllowGet
			             	};

			result.ExecuteResult(context);
		}
	}
}